package com.es.servlet;
/**
 * 描述:
 * es-jsp-
 *
 * @author Derek
 * 创建时间：2022-04-25 10:24
 */

import com.es.bean.Student;
import com.es.service.StudentService;
import com.es.service.impl.StudentServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.PreparedStatement;
import java.util.List;

@WebServlet(name = "ListServlet", value = "/list")
public class ListServlet extends HttpServlet {

    StudentService service = new StudentServiceImpl();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //查询到的数据到前端？

        List<Student> list = service.list();

        //请求分派
        //带着数据到jsp
        request.setAttribute("list", list);
        request.getRequestDispatcher("manage.jsp").forward(request,response);
    }

}
